package com.example.exam10.dao;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

import com.example.exam10.entity.Person;

import java.util.List;

@Dao
public interface PersonDao {
    @Insert
    Long insertPerson(Person person);

    @Update
    void updatePerson(Person person);

    @Query("SELECT * FROM Person ")
    List<Person> loadAllPersons();

    @Delete
    void deletePerson(Person person);

    @Query("select * from Person where name like '%'|| :param ||'%' or phone like '%'|| :param ||'%'")
    List<Person> searchPerson(String param);
}
